package com.huawei.hms.common.internal;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import com.huawei.hms.support.log.HMSLog;

public abstract class DialogRedirect implements OnClickListener {
    protected abstract void redirect();

    public static DialogRedirect getInstance(Activity activity, Intent intent, int i) {
        return new DialogRedirectImpl(intent, activity, i);
    }

    public void onClick(DialogInterface dialogInterface, int i) {
        try {
            redirect();
        } catch (Throwable th) {
            HMSLog.e("DialogRedirect", "Failed to start resolution intent");
        } finally {
            dialogInterface.dismiss();
        }
    }
}
